Skip to main content

All Questions

1vote
1answer
234views

Refactoring instanceOf, moving logic to POJO when it has database interaction

I'm refactoring some old code, I have a lot of istanceOf in the business part: if (record instanceof RecordA) { RecordA recordA = (RecordA) record; ...
Accollativo's user avatar
2votes
1answer
204views

Is it allowed to include the composition in the compositor in the Strategy Pattern

I have a range of different animals in my zoo such as turtles, birds etc. As they all share a common trait such as either swimming, flying etc., I thought a strategy pattern would be appropriate to ...
Tyler D's user avatar
0votes
6answers
247views

Adding client specific method to a listener interface is a good idea?

I'm using a listener pattern where a class A listens for events from various classes B, C, D with the help of a listener interface I Essentially the structure looks like: interface I { void ...
Shivam Pokhriyal's user avatar
3votes
1answer
4kviews

Should an abstract class implement an interface, as opposed to defining its own abstract methods?

I'm defining a class structure for persisting to our cassandra database, and I'm unsure about using a combination of an abstract class and an interface. I have two concrete classes, one for persisting ...
Eoin's user avatar
  • 141
0votes
3answers
368views

Send records using async or sync way

I have bunch of keys and values that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K ...
user1950349's user avatar
2votes
5answers
1kviews

Facade pattern or just expose child objects?

Wondering about pros and cons around a facade pattern implementation (or perhaps there is a better pattern I should consider), versus simply exposing a dependent object to a caller. Consider the ...
gdbj's user avatar
  • 123
1vote
2answers
328views

Is this one method interface a good response to this interview question?

Today I received a rejection letter from a company where as part of the interview process they gave a a couple days to respond to the following question (paraphrased): Let’s say say you have ...
Ryan1729's user avatar
3votes
1answer
540views

Contract interface/class with inner classes/interfaces

Brief description of my project structure. I have some base classes like BaseView, BasePresenter ... . Also my project consists of modules, module represents one complete part of the application. ...
CROSP's user avatar
  • 1,558
3votes
1answer
184views

Leo Brodie's "Interface Component"

On page 85 of Leo Brodie's book, Thinking Forth, he describes a component which he calls the "Interface Component." He describes its differences from, and benefits over a standard interface ...
dmux's user avatar
  • 151
3votes
3answers
2kviews

Preemptive interfaces in Java - good, bad or "a matter of taste"

I frequently come across projects that strictly define an interface for each and every class. 90% of those interfaces feature only a single implementation. Proponents of these "preemptive interfacs" ...
Fritz Duchardt's user avatar
4votes
3answers
6kviews

Communicating to an Object from another without coupling in java?

So I have a Person object, and a GumballMachine object. The behavior I'm searching for is, in the intent to avoid unnecessary coupling, have the method insertCoin() called from within the Person ...
user avatar
2votes
1answer
617views

Define an object with the interface as a type instead of class name [duplicate]

I try to practice with the design patterns and explore one of the possible implementations of the Observer Design Pattern in Java. I paid attention, that in this example the object is defined with the ...
Mike's user avatar
  • 135
8votes
2answers
864views

Optional features: default method or separated interface

Dedicated interfaces seems to be a good way to expose the optional features in a domain-specific type hierarchy. However, they impede the use of decorator and composite patterns, which is also common ...
billc.cn's user avatar
-4votes
2answers
192views

Advantages of these recommendations in ooprogramming using Java

Below are the recommendation from section 5.1 of this essay. While Java is not a pure object-oriented language, it is possible to program in a pure object-oriented style by obeying the following ...
overexchange's user avatar
11votes
5answers
3kviews

Separate interface for mutation methods

I've been working on refactoring some code, and I think I may have taken the first step down the rabbit hole. I'm writing the example in Java, but I suppose it could be agnostic. I have an interface ...
Zymus's user avatar
  • 2,533

153050per page
close